let app = getApp();
import { getOrderLeaseTerm } from "../../api";
Page({
  data: {
    leaseInfo: {},
    goods_id: '', 
    setmeal_id: '', 
    spec_id: '', 
    amount: '',
    goods_img: '',
    stagesModal: false
  },
  onLoad(option) {
    console.log('option',option)
    const { goodsId, setmealId, specId, num, goodsImg } = option
    this.setData({
      goods_id: goodsId || '703', 
      setmeal_id: setmealId || '765', 
      spec_id: specId || '2650', 
      amount: num || '1',
      goods_img: goodsImg
    })
    this.getList()
  },
  getList(){
    const { goods_id, setmeal_id, spec_id, amount } = this.data
    let params = {
      goods_id: goods_id,
      setmeal_id: setmeal_id,
      spec_id: spec_id,
      amount: amount,
    }
    getOrderLeaseTerm(params).then(res =>{
      console.log('租期',res)
      this.setData({
        leaseInfo: res
      })
    })
  },
  returnBack(){
    my.navigateBack()
  },
  openStagesModal(){
    this.setData({
      stagesModal: true
    })
  },
  closestagesModal(){
    this.setData({
      stagesModal: false
    })
  },


});
